/**
 * 路由管理模块
 * 统一管理应用的路由配置
 * 
 * 所有导入语句都在文件顶部 (不然爆红)
 * 没有未使用的导入(不然爆黄)
 * 路由配置完整且正确
 */
import { createBrowserRouter, RouteObject } from 'react-router-dom';
import { lazy, Suspense } from 'react';
// 导入loading组件
import Loading from '@/components/Loading';
// 导入页面组件（使用懒加载）
const Home = lazy(() => import('@/pages/Home/index'));
const Login = lazy(() => import('@/pages/Login/index'));
const NotFound = lazy(() => import('@/pages/NotFound/index'));
const Resume = lazy(() => import('@/pages/Resume/index'));


// 路由配置
const routes: RouteObject[] = [
  {
    path: '/login',
    element: <Suspense fallback={<Loading />}><Login /></Suspense>,
  },
  {
    path: '/',
    element: <Suspense fallback={<Loading />}><Home /></Suspense>,
  },
  {
    path: '/resume',
    element: <Suspense fallback={<Loading />}><Resume /></Suspense>,
  },
  {
    path: '*',
    element: <Suspense fallback={<Loading />}><NotFound /></Suspense>,
  },
];

const router = createBrowserRouter(routes);
export default router;